import React, { useState } from 'react';
import { Button, Modal } from 'antd';
import ModalForm from './ModalForm';

interface FormItemOption {
  value: string | number;
  label: string;
}

interface FormItemConfig {
  name: string;
  label: string;
  type?: 'input' | 'select';
  required?: boolean;
  options?: FormItemOption[];
}

interface PublicModalProps {
  formItems: FormItemConfig[];
  visibity: boolean;
  setVisibity: (visibity: boolean) => void;
  title: string;
  formParams: any;
}

const PublicModal: React.FC<PublicModalProps> = (props) => {

  const showModal = () => {
    props.setVisibity(true);
  };

  const handleCancel = () => {
    props.setVisibity(false);
  }
  return (
    <>
      <Modal
        title={props.title}
        closable={{ 'aria-label': 'Custom Close Button' }}
        open={props.visibity}
        onCancel={handleCancel}
        footer={null}
      >
        <ModalForm formItems={props.formItems} handleCancel={handleCancel} formParams={props.formParams} />
      </Modal>
    </>
  );
};

export default PublicModal;